import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with Intellij IDEA.
 * Description;
 * User:TQ02
 * Data:2023-10-24
 * Time:17:38
 * Text：牛客——幸运的袋子
 */
public class Text3 {
    public static int count(int[] array,int num,int pos,int sum,int multi){
        int count=0;
        for(int i=pos;i<num;i++)
        {
            sum+=array[i];
            multi*=array[i];
            if(sum > multi)
            {
                count=count+1+count(array,num,i+1,sum,multi);
            }else if(array[i]==1){
                count=count+count(array,num,i+1,sum,multi);
            }else{
                break;
            }
            sum-=array[i];
            multi/=array[i];
            while(i<num-1 && array[i]==array[i+1]){
                i++;
            }
        }
        return count;
    }
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = in.nextInt();//球数目
        int[] array=new int[num];//球号码
        for(int i=0;i<num;i++){
            array[i]=in.nextInt();
        }
        Arrays.sort(array);
        System.out.println(count(array,num,0,0,1));
    }
}

